package com.another.bidservice.dao.jpa;

import com.another.bidservice.entity.TPlan;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.query.Param;

import java.io.Serializable;
import java.util.List;

public interface PlanJPADao extends JpaRepository<TPlan, String>, Serializable {


    List<TPlan> findAllByPlanNoInAndPlanStatusIs(List<String> planNos, String planStatus);

    List<TPlan> findAllByMainNo(String mainNo);
    List<TPlan> findAllByMainNoIn(List<String> mainNos);

    @Modifying
    @Query(value = "update TPlan p set p.planStatus=:planStatus where p.mainNo = :mainNo")
    int updatePlanStatus(@Param("planStatus") String planStatus, @Param("mainNo") String mainNo);

}


